arm: imx: hab: Add hab_failsafe console command
authorBryan O'Donoghue <[email protected]>
Fri, 12 Jan 2018 12:40:19 +0000 (12:40 +0000)
committerStefano Babic <[email protected]>
Sun, 14 Jan 2018 16:26:30 +0000 (17:26 +0100)
hab_failsafe when called puts the part into BootROM recovery mode.
This will allow u-boot scripts to script the dropping down into recovery
mode.

=> hab_failsafe

Shows the i.MX7 appear as "hiddev0,hidraw5: USB HID v1.10 Device [Freescale
SemiConductor Inc  SP Blank ULT1] " in a Linux dmesg thus allowing download
of a new image via the BootROM USB download protocol routine.

Signed-off-by: Bryan O'Donoghue <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Albert Aribaud <[email protected]>
Cc: Sven Ebenfeld <[email protected]>
Cc: George McCollister <[email protected]>
Cc: Breno Matheus Lima <[email protected]>
Tested-by: Breno Lima <[email protected]>
Reviewed-by: Fabio Estevam <[email protected]>
arch/arm/mach-imx/hab.c

index 1236717b3ecafc4e232ae91fb517557246274234..5f197775c13a28a216c653d1858cfbaeeecfe2b2 100644 (file)
@@ -414,6 +414,22 @@ static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc,
        return rcode;
 }
 
+static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc,
+                          char * const argv[])
+{
+       hab_rvt_failsafe_t *hab_rvt_failsafe;
+
+       if (argc != 1) {
+               cmd_usage(cmdtp);
+               return 1;
+       }
+
+       hab_rvt_failsafe = hab_rvt_failsafe_p;
+       hab_rvt_failsafe();
+
+       return 0;
+}
+
 U_BOOT_CMD(
                hab_status, CONFIG_SYS_MAXARGS, 1, do_hab_status,
                "display HAB status",
@@ -429,6 +445,11 @@ U_BOOT_CMD(
                "ivt_offset - hex offset of IVT in the image"
          );
 
+U_BOOT_CMD(
+               hab_failsafe, CONFIG_SYS_MAXARGS, 1, do_hab_failsafe,
+               "run BootROM failsafe routine",
+               ""
+         );
 
 #endif /* !defined(CONFIG_SPL_BUILD) */